package main;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.Map;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;

import model.Animal;
import model.Simulator;

import controller.AbstractController;
import controller.ParamController;
import controller.SettingsController;
import controller.SpeedController;
import controller.StepsController;


import view.AbstractView;
import view.FieldView;
import view.HistorieGramView;
import view.LegendView;
import view.PieView;
import view.ProgGraph;
import view.StatsView;
import view.TextView;
import javax.swing.JTabbedPane;
import java.awt.Panel;

/**
 * The class Window
 * @author Arjan Frans, Alwin Rombout, Jelte Verbree, Brendan Kanters
 * @version 1.0
 */
public class Window extends JFrame {
	
	private static final long serialVersionUID = -7085266268018778071L;
	private Simulator simulator;
    private AbstractController stepsController;
    private AbstractController paramController;
    private AbstractController settingsController;
    private AbstractController speedController;
    
    private AbstractView statsView;
    private AbstractView fieldView;
    private AbstractView pieView;
    private AbstractView historieGramView;
   // private AbstractView progGraph;
    
    private LegendView legend;
    
	private AbstractView textView;

	private JTabbedPane tabbedPane_2;
	private JPanel panel_5;
	private JPanel panel_6;
	private JPanel panel_7;
	private JPanel panel_8;
	private JPanel panel_9;
	private JPanel panel;
	
	
	/**
	 * Constructor to create a new Window    
	 */
    public Window() 
    {
    	
        this.setTitle("Fox and Rabbit Simulation");
	    this.setSize(853, 760);
	    this.setResizable(true);
        getContentPane().setLayout(null);
    	
    	simulator = new Simulator();

        statsView = new StatsView(simulator);
        fieldView = new FieldView(simulator);
        pieView = new PieView(simulator);
        textView = new TextView(simulator);
        historieGramView = new HistorieGramView(simulator);
        //progGraph = new ProgGraph(simulator);
        
        
	    tabbedPane_2 = new JTabbedPane(JTabbedPane.TOP);
	    tabbedPane_2.setBounds(0, 0, 784, 522);
	    getContentPane().add(tabbedPane_2);
	    
	    panel_5 = new JPanel();
	    fieldView.setBounds(0,0,522, 522);
	    fieldView.setSize(522,522);
	    panel_5.add(fieldView);
	    tabbedPane_2.addTab("Simulatie", null, panel_5, null);
	    
	    panel_6 = new JPanel();
	    pieView.setBounds(0,0,300,300);
	    panel_6.add(pieView);
	    tabbedPane_2.addTab("Taartdiagram", null, panel_6, null);
	    
	    panel_7 = new JPanel();
	    historieGramView.setBounds(0,0,300,300);
	    panel_7.add(historieGramView);
	    tabbedPane_2.addTab("Histogram", null, panel_7, null);
	    
	    panel_8 = new JPanel();
	    textView.setBounds(0,0,300,300);
	    panel_8.add(textView);
	    tabbedPane_2.addTab("Statistieken", null, panel_8, null);
	    
	    panel_9 = new JPanel();
	    //progGraph.setBounds(0,0,750,425);
	   // panel_9.add(progGraph);
	    tabbedPane_2.addTab("Progressie", null, panel_9, null);
	    
	    panel = new JPanel();
	    tabbedPane_2.addTab("Instellingen", null, panel, null);
	    
	    settingsController = new SettingsController(simulator);
	    panel.add(settingsController);
	    
	    statsView.setBounds(393,534,391,58);
	    getContentPane().add(statsView);
	    stepsController = new StepsController(simulator);
	    stepsController.setBounds(14, 595, 367, 58);
	    getContentPane().add(stepsController);
	    paramController = new ParamController(simulator);
	    paramController.setBounds(14, 534, 367, 50);
	    getContentPane().add(paramController);
	    speedController = new SpeedController(simulator);
	    speedController.setBounds(393,603,391,50);
	    getContentPane().add(speedController);
	    
	    legend = new LegendView();
	    legend.setBounds(174,666,500,40);
	    getContentPane().add(legend);
	    
	    this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	    this.setVisible(true);	
	}
}
